//Accepted
#include <cstdio>
#include <cstring>

int i, j,k, n, a[5005][5005], x, y;
bool z[5005][5005];

void vai(){
	memset(z, 0, sizeof(z));
	k=0;
	x=4;
	y=2;
	for(j=i=-1;i<5004&&j<5004;++k){
		if(x==0)i--;
		else i++;
		if(y==0)j--;
		else j++;
		
		a[i][j]=k;
		z[i][j]=1;
		//printf("%d %d  %d\n", i, j, k);
		
		x=(x+1)%4;
		y=(y+1)%4;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	vai();
	scanf("%d", &n);
	while(n--){
		scanf("%d%d", &x, &y);
		if(z[x][y])printf("%d\n",a[x][y]);
		else printf("No Number\n");
	}
	return 0;
}
